20.2.7 Known Limitations(已知限制)
1 | Restart functionality does not work well with objects that are |
重新启动功能不适用于那些通过使用标准的ObjectInputStream进行反序列化的对象。如果您需要反序列化数据,你可能需要使用Spring的ConfigurableObjectInputStream结合使用Thread.currentThread().getContextClassLoader()。1
2
3Unfortunately, several third-party libraries deserialize without
considering the context classloader. If you find such a problem,
you need to request a fix with the original authors.
不幸的是,一些第三方的库反序列化的时候未考虑容器类加载器。如果您发现了这个问题,您需要请求作者做相应的修改。
20.3 LiveReload
1 | The spring-boot-devtools module includes an embedded LiveReload server |
spring-boot-devtools模块引入了内置LiveReload服务器,当一个资源发生改变时,能够触发浏览器自动刷新,LiveReload浏览器扩展对于Chrome和Firefox还有Safari提供免费支持(livereload.com)。1
2If you do not want to start the LiveReload server when your application
runs, you can set the spring.devtools.livereload.enabled property to false.
如果您子在您的应用运行的时候不想启动LiveReload服务器,您可以通过spring.devtools.livereload.enabled属性来设置成false。1
2
3
4You can only run one LiveReload server at a time. Before starting your
application, ensure that no other LiveReload servers are running. If
you start multiple applications from your IDE, only the first has
LiveReload support.
您一次只能运行一个LiveReload服务器。在启动您的应用之前,确保没有其他的LiveReload服务器在运行。如果您在IDE中运行多个应用,仅仅第一个运行的应用能够有LiveReload的效果。
20.4 Global Settings(全局设置)
1 | You can configure global devtools settings by adding a file named |
您可以通过增加名为.spring-boot-devtools.properties(注意文件名以.开头的)的文件到您的$HOME文件夹来配置全局的devtools设置。任何属性被增加到这个文件将会被应用生效到所有的您机器上使用devtools的Spring Boot应用中。举个例子,去配置重启使用一个触发文件,您可以增加如下属性:
~/.spring-boot-devtools.properties.1
spring.devtools.reload.trigger-file=.reloadtrigger